package com.duanjw.springboot.kubernetes;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * kubernetes 应用，将此应用部署到 k8s
 *
 * @author duanjw
 * @since 2022/3/31
 */
@RestController
@RequestMapping
@SpringBootApplication
public class KubernetesApplication {
    static Logger log = LoggerFactory.getLogger(KubernetesApplication.class);

    public static void main(String[] args) {
        SpringApplication.run(KubernetesApplication.class, args);
    }

    /**
     * curl localhost:8080/world
     *
     * @param name
     * @return
     */
    @GetMapping("{name}")
    public String hello(@PathVariable String name) {
        log.info("hello {}", name);
        return "hello " + name;
    }
}
